package com.example.hotelsystem.mapper;

import com.example.hotelsystem.entity.Hotelorder;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Select;

import java.util.Date;
import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author Lee
 * @since 2020-10-20
 */
public interface HotelorderMapper extends BaseMapper<Hotelorder> {

    @Select("select * from hotelorder where room_id=#{roomId} and deleted = 0 and status=1 and not(checkin_time > #{checkinTime} or checkout_time < #{checkoutTime})")
    public List<Hotelorder> checkOrder(Long roomId, Date checkinTime,Date checkoutTime);



    @Select("select * from hotelorder where status=1 and deleted=0 and not(checkin_time > #{checkinTime} or checkout_time < #{checkoutTime})")
    public List<Hotelorder> BookableList(Date checkinTime,Date checkoutTime);


    @Select("select sum(price) from hotelorder where pay_time > #{datetime} and deleted=0")
    public Double DayProfit(String datetime);
}
